home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / Sample Code / Pascal Sample 3.0B10 / Source / Features.p < prev    next >
Encoding:
Text File  |  1993-10-13  |  2.9 KB  |  81 lines  |  [TEXT/MPS ]

  1. (******************************************************************************
  2. *
  3. *    Apple Macintosh Developer Technical Support
  4. *
  5. *    Interfaces for feature determination
  6. *
  7. *    Program:    Sample 3.0
  8. *    FILE:        Features.p - Pascal implementation
  9. *
  10. *    by:        Matt Deatherage
  11. *
  12. *    Copyright © 1988-1993 Apple Computer, Inc.
  13. *    All rights reserved.
  14. *
  15. *******************************************************************************
  16. *
  17. * This unit, the "Features" unit, includes the compatibility information we
  18. * need to run with. Before using several features of the Macintosh operating
  19. * system or toolbox, it's wise programming practice to insure they actually
  20. * exist.  "Wise" means "If you call something that's not there, it's gonna
  21. * crash." 
  22. * There's a few nifty routines provided by the System Software to help with
  23. * all this, and we collect most of them into this unit to keep the code a
  24. * bit cleaner.  The major call to the unit is "DetermineFeatures", which
  25. * makes sure everything we need to examine the features we want is present
  26. * -- mostly Gestalt.  The same call also is a convenient place to set any
  27. * global variables we have that we want to use throughout the program. 
  28. * Rather than call Gestalt every time we need to check for color QuickDraw,
  29. * we check for it in DetermineFeatures and keep it in a global
  30. * variable.    This is easy to extend to include all the things you want to
  31. * check for. 
  32. * Sample calls DetermineFeatures from Initialize.
  33. *
  34. ******************************************************************************)
  35.  
  36. UNIT Features;
  37.  
  38. INTERFACE
  39.  
  40. (*******************************************************************************
  41. * Used Units
  42. *******************************************************************************)
  43.  
  44. USES GestaltEqu, OSUtils, Resources;
  45.  
  46. (*******************************************************************************
  47. * Global variables maintained by this unit
  48. *******************************************************************************)
  49.  
  50. VAR
  51.     gHasGestalt,                 { TRUE if Gestalt is implemented }
  52.     gHasHelpMgr,                 { TRUE if the Help Manager is present }
  53.     gHasColorQD,                 { TRUE if color QuickDraw is present }
  54.     gHas32BitQD,                 { TRUE if 32-Bit QuickDraw is installed }
  55.     gHasFindFolder,                { TRUE if FindFolder is available }
  56.     gHasDeviceLoop,             { TRUE if the DeviceLoop trap is implemented }
  57.     gHasAppleEvents: BOOLEAN;    { TRUE if the Apple Event Manager is present }
  58.     
  59.     gAppsResourceFile: INTEGER; { the resource file number of our application
  60.                                   file }
  61.  
  62. (*******************************************************************************
  63. *
  64. * DetermineFeatures - figure out what system features are present
  65. *
  66. * This routine examines the system and sets global variables listed above
  67. * to indicate what system features are present, if we're interested at
  68. * all.
  69. *
  70. *******************************************************************************)
  71.  
  72. FUNCTION DetermineFeatures: BOOLEAN;
  73.  
  74. IMPLEMENTATION
  75.  
  76.     {$I Features.inc1.p}
  77.  
  78. END. { unit Features }
  79.